<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="support.*, java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Specialization</title>

<script type="text/javascript">
	function test(){
		//alert("testtttttt");
		var index = document.lame.special.selectedIndex;
		var str = document.lame.special.options[index].value;
		window.location.href="verification.jsp?specialization="+str;
	}
</script>
</head>

<body>
	<h1>Specialization</h1>
	
	<%
	
	student stu = (student)session.getAttribute("student");
	String firstName = (String)stu.getAttribute("firstName");
    String lastName = (String)stu.getAttribute("lastName");
	String middleName = (String)stu.getAttribute( "middleName" );
	String citizenship = (String)stu.getAttribute( "citizenship" );
	String residence = (String) stu.getAttribute( "residence" );
	String street = (String)stu.getAttribute( "street" );
	String city = (String)stu.getAttribute( "city" );
	String phone = (String)stu.getAttribute( "phone" );
	
	out.println(firstName + " " + middleName + " " + lastName +"</br>");
	out.println("Country of Citizenship: " + citizenship + "</br>");
	out.println("Country of Residence: " + residence + "</br>");
	out.println("Address </br>");
	out.println("Street: " + street + "</br>");
	out.println("City: " + city + "</br>");
	
	
	String resident = request.getParameter( "resident" );
	if(resident != null){
		stu.setAttribute("resident",resident);
		String phoneCode = (String)stu.getAttribute( "phoneCode" );
		out.println("Resident: " + resident + "</br>");
		out.println("Phone Code: " + phoneCode + "</br>");
	}
	else if(request.getParameter( "moreDegrees" ) == null){
		String state = request.getParameter( "state" );
		String zipCode = request.getParameter( "zipCode" );
		out.println("State: " + state + "</br>");
		out.println("Zip Code: " + zipCode + "</br>");
	}
	out.println("Phone: " + phone  + "</br>");
	session.setAttribute("student", stu);

	
%>	
	
	
	<%
		support s = new support();   	
		String path4 = config.getServletContext().getRealPath("specializations.txt");
		Vector specializations = s.getSpecializations(path4);
	%>

	<form name="lame" method="GET" action="verification.jsp">
	Select a Specialization:<br>
		<select name="special" id="special">
		<%
			for(int i=0; i<specializations.size(); i++){
					String specialization = (String)specializations.get(i);
			      out.println("<option value=\'" + specialization + "\'>" + specialization + "</option>");
			}
		%>
		</select>
		<br>
	   <input type="button" value="Submit" onclick="test()"/>
   </form>
</body>
</html>